namespace UniversalAdminSystem.Domian.UserManagement.ValueObj;

public record UserEmail
{
    public string Value { get; }
    private UserEmail(string value)
    {
        if (string.IsNullOrWhiteSpace(value))
            throw new ArgumentException("邮箱不能为空");
        if (!System.Text.RegularExpressions.Regex.IsMatch(value, @"^[^@]+@[^@]+\.[^@]+$"))
            throw new ArgumentException("邮箱格式不正确");
        Value = value;
    }
    public static UserEmail Create(string value) => new(value);
    public static implicit operator string(UserEmail email) => email.Value;
} 